goodhistogram: add ValuesAtQuantiles and common Params presets#3
Merged
angles-n-daemons merged 1 commit intomainfrom Apr 29, 2026
Merged
Conversation
Computing p50/p90/p99/p999 with individual ValueAtQuantile calls redundantly walks the bucket array and recomputes boundary densities for each quantile. ValuesAtQuantiles resolves all requested quantiles in a single pass: it sorts them by rank, computes boundary densities once, and processes each quantile as the walk reaches its bucket. Also adds common Params presets (HiResLatency, IOLatency, ResponseTime, LongRunning, DataSize, MemoryUsage) modeled after CockroachDB's histogram_buckets.go tiers, so callers don't need to research appropriate ranges for standard measurement scenarios. Co-Authored-By: roachdev-claude <[email protected]>
17ed27e to
be7dbe1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Computing p50/p90/p99/p999 with individual
ValueAtQuantilecalls redundantly walks the bucket array and recomputes boundary densities for each quantile.ValuesAtQuantilesresolves all requested quantiles in a single pass: it sorts them by rank, computes boundary densities once, and processes each quantile as the walk reaches its bucket.Also adds common
Paramspresets modeled after CockroachDB'shistogram_buckets.gotiers, so callers don't need to research appropriate ranges for standard measurement scenarios:HiResLatencyParams(1us - 5m) — full-range request latencyIOLatencyParams(10us - 10s) — RPC, disk I/OResponseTimeParams(1ms - 30s) — SQL, HTTPLongRunningParams(500ms - 1h) — backups, migrationsDataSizeParams(1KB - 16MB) — payloadsMemoryUsageParams(1B - 64MB) — allocations